x = input("Введите комбинацию:")
c = 0
op = "([{<"
cl = ")]}>"
m = []
flag = True
for char in x:
    if char in op:
        m.append(char)
    if char in cl:
        for i in range(len(m)):
            if op.find(m.pop()) != cl.find(char):
                flag = False
                break
print(len(m) == 0 and flag)